import React from 'react';
import PropTypes from 'prop-types';

class LoadMore extends React.Component {
  constructor() {
    super();
    this.state = {

    }
    this.getMore = this.getMore.bind(this)
  }
  getMore() {
    this.props.getMore();
  }
  render() {
    return (
      <div className="load-more">
        { this.props.isLoading ?
          <div className="loading">加载中...</div>
           :
          ''
        }
        { !this.props.isLoading && this.props.hasMore ?
          <span className="more" onClick={this.getMore} >点击加载更多</span>
           :
          ''
        }
        { !this.props.isLoading && !this.props.hasMore ?
          <p className="more">没有更多了</p>
            :
          ''
        }
      </div>
    )
  }
}
export default LoadMore;
LoadMore.propTypes = {
  getMore: PropTypes.func.isRequired,
  isLoading: PropTypes.bool,
  hasMore: PropTypes.bool,
}
